Skip to content

fix(release): make the version stamp work on macOS and RPM - #85

Merged
kylehgc merged 1 commit into
developfrom
fix/version-stamp-portability
Aug 1, 2026
Merged

kylehgc merged 1 commit into
developfrom
fix/version-stamp-portability

Conversation

@kylehgc

@kylehgc kylehgc commented Aug 1, 2026

Copy link
Copy Markdown
Owner

The version stamp from #83 broke two of the seven build jobs. Both failures are mine and neither was visible without running it.

Build aarch64-apple-darwin   FAILED   Stamp version from tag
Build x86_64-apple-darwin    FAILED   Stamp version from tag
Build RPM package            FAILED   Generate RPM
Build DEB package            ok
Build x86_64-pc-windows-msvc ok
Build x86_64-unknown-linux-musl ok
Build aarch64-unknown-linux-gnu ok

macOS: two GNU-isms, not one

sed: 1: "Cargo.toml

BSD sed reads the argument after -i as a backup suffix, so the GNU form consumes the script. But fixing that alone would still have failed: 0,/re/ — the address range used to match only the first version = — is also a GNU extension that BSD sed rejects. Uses awk instead, which behaves identically on both.

This is the same mistake as the BSD grep failure in non_utf8_argv_test earlier today: verified against GNU tooling on Windows, shipped to a macOS runner.

RPM: cargo and rpm disagree about -

invalid version "0.1.0-rc.10": contains invalid character
(allowed: alphanumeric, '.', '_', '+', '%', '{', '}', '~', '^')

RPM forbids - in a version; cargo requires semver. The error message names the escape — + is legal in RPM, and semver permits it as build metadata. So the pre-release marker becomes +rc.N:

0.1.0-rc.10 0.1.0+rc.10
cargo ✅ ✅
dpkg ✅ ✅
rpm ❌ ✅

~ would sort better for both rpm and deb (it orders before the release), but cargo rejects it outright.

Verified

--test                    all 5 tag forms
cargo metadata            0.1.0+rc.10
rpm charset               0.1.0+rc.10 uses only characters rpm's error lists as legal
stamp diff                line 3 only; clap/serde/serde_json intact
stable path               fork-v0.1.0 -> 0.1.0
malformed tag             rejected, manifest untouched

Still unverified

The .deb/.rpm filenames, and BSD awk itself — both need the real runners. The macOS job and the next RC's published assets are the checks worth watching after merge.

The stamp shipped in #83 broke two of the seven build jobs.

macOS — `sed: 1: "Cargo.toml`. Two separate GNU-isms, only one of which was
obvious: BSD sed reads the argument after -i as a backup suffix, and the
`0,/re/` address range used to match only the first occurrence is a GNU
extension BSD rejects outright. Fixing the first alone would still have failed.
Uses awk instead, which behaves the same on both.

RPM — `invalid version "0.1.0-rc.10": contains invalid character (allowed:
alphanumeric, '.', '_', '+', '%', '{', '}', '~', '^')`. RPM forbids '-' in a
version, but cargo requires semver. The tool's own error names the way out: '+'
is legal in RPM, and semver allows it as build metadata. So the pre-release
marker becomes +rc.N rather than -rc.N, which cargo, dpkg and rpm all accept.
'~' would sort better for rpm and deb, but cargo rejects it.

This is the same failure I made earlier today with BSD grep in
non_utf8_argv_test: verified against GNU tooling on Windows, shipped to a macOS
runner. Checked explicitly for it this time — the awk rewrite was prompted by
noticing the 0,/re/ range would fail on BSD even after the -i fix.

Verified:
- all five tag forms derive correctly
- cargo metadata reports 0.1.0+rc.10
- 0.1.0+rc.10 contains only characters rpm's error message lists as legal
- the stamp rewrites line 3 only; clap/serde/serde_json versions intact
- the stable path yields a bare 0.1.0
- a malformed tag is rejected rather than corrupting the manifest

Still unverified locally: the .deb/.rpm filenames, which need cargo-deb and
cargo-generate-rpm on Linux, and BSD sed/awk behaviour itself. The next RC's
published assets and the macOS job are the checks.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@kylehgc
kylehgc merged commit 7f20a32 into develop Aug 1, 2026
11 checks passed
@kylehgc
kylehgc deleted the fix/version-stamp-portability branch August 1, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant